package com.elitel;

//import com.elitel.common.redis.RedisDbIndex;

import org.apache.logging.log4j.core.lookup.MainMapLookup;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.PropertySource;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication(exclude = MongoAutoConfiguration.class)//排除MongoAutoConfiguration,避免启动报localhost:27017 连接错误
//@PropertySource({"application1.properties1", "quartz.properties"})// 为啥要引入application1.properties1,难以理解
@PropertySource({"quartz.properties"})
@EnableScheduling
//@EnableEurekaClient
public class BaseFrameWebApplication {

  //	@ApolloConfig
  //	private static Config applicationConfig;

  public static void main(String[] args) {
    /**
     * Springboot整合Elasticsearch 在项目启动前设置一下的属性，防止报错 解决netty冲突后初始化client时还会抛出异常
     * java.lang.IllegalStateException: availableProcessors is already set to [4], rejecting [4]
     */
    System.setProperty("es.set.netty.runtime.available.processors", "false");
    MainMapLookup.setMainArguments(args);
    ConfigurableApplicationContext context = SpringApplication.run(BaseFrameWebApplication.class, args);
    //		int rdi = applicationConfig.getIntProperty("spring.redis.database",0);
//    int rdi = 0;
//    RedisDbIndex.setValue(rdi);
//    InitSQL init = new InitSQL();
//    init.getConnection(context);
  }
}
